package com.dev.bbs.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dev.bbs.domain.BbsSignRule;
import com.dev.bbs.mapper.BbsSignRuleMapper;
import com.dev.bbs.service.IBbsSignRuleService;

/**
 * 签到规则Service业务层处理
 * 
 * @author dev
 * @date 2019-09-19
 */
@Service
public class BbsSignRuleServiceImpl implements IBbsSignRuleService
{
    @Autowired
    private BbsSignRuleMapper bbsSignRuleMapper;

    /**
     * 查询签到规则
     * 
     * @param signRuleId 签到规则ID
     * @return 签到规则
     */
    @Override
    public BbsSignRule selectBbsSignRuleById(Integer signDay)
    {
        return bbsSignRuleMapper.selectByPrimaryKey(signDay);
    }

    /**
     * 查询签到规则列表
     * 
     * @param bbsSignRule 签到规则
     * @return 签到规则
     */
    @Override
    public List<BbsSignRule> selectBbsSignRuleList(BbsSignRule bbsSignRule)
    {
        return bbsSignRuleMapper.select(bbsSignRule);
    }

    /**
     * 新增签到规则
     * 
     * @param bbsSignRule 签到规则
     * @return 结果
     */
    @Override
    public int insertBbsSignRule(BbsSignRule bbsSignRule)
    {
        return bbsSignRuleMapper.insert(bbsSignRule);
    }

    /**
     * 修改签到规则
     * 
     * @param bbsSignRule 签到规则
     * @return 结果
     */
    @Override
    public int updateBbsSignRule(BbsSignRule bbsSignRule)
    {
        return bbsSignRuleMapper.updateByPrimaryKeySelective(bbsSignRule);
    }

    /**
     * 删除签到规则对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteBbsSignRuleByIds(String ids)
    {
        return bbsSignRuleMapper.deleteByIds(ids);
    }

    /**
     * 删除签到规则信息
     * 
     * @param signDay 签到规则ID
     * @return 结果
     */
    @Override
    public int deleteBbsSignRuleById(Integer signDay)
    {
        return bbsSignRuleMapper.deleteByPrimaryKey(signDay);
    }

    /* (non-Javadoc)
     * @see com.dev.bbs.service.IBbsSignRuleService#getReward(int)
     */
    @Override
    public int getReward(int signDay)
    {
        return bbsSignRuleMapper.getReward(signDay);
    }
}
